<!DOCTYPE html>
<html>
<head>
<meta charset="windows-1255">
<title>DB Content Exapmle111</title>
</head>
<body>

<h1>Flights</h1>
Note not all operations can be done multiple times. Resetting DB to original state is advised..<br><br>
<form action="DBsample" METHOD="GET">
<b>0. Reset/Init DB to original state:</b><br>
<input type="radio" name="qid" value="0"><b>Reset DB</b><br><br>
<b>1. Select all airline companies registered to Flights R' Us:</b><br>
<input type="radio" name="qid" value="1">SELECT * FROM airline<br><br>
<b>2. Select all flights between now and 1 month from now from Ben Gurion to Barcelona:</b><br>
<input type="radio" name="qid" value="2">SELECT * FROM flight t where t.arrival_airport = 'Barcelona' and t.depart_date between now() and now() + interval 1 month<br><br>
<b>3. The sum of money a person spent on ordering tickets in the website:</b><br>
<input type="radio" name="qid" value="3">SELECT sum(cost) FROM ticket b join booking a on (a.booking_id = b.booking_id) join flight_seat c on (c.seat_id = b.seat_id) where a.user_id = 1<br><br>
<b>4. Amount of orders each day:</b><br>
<input type="radio" name="qid" value="4">SELECT DAY(BOOKING_DATE), COUNT(*) FROM booking GROUP BY  DAY(BOOKING_DATE);<br><br>
<b>5. Discount on all Amsterdam flights: </b><br>
<input type="radio" name="qid" value="5">UPDATE flight_seat SET cost = 0.9*cost WHERE flight_id in (select flight_id from flight where arrival_airport = 'Amsterdam')<br><br>
<b>6. Change seat to non-reserved:</b><br>
<input type="radio" name="qid" value="6">UPDATE flight_seat SET reserved='0' WHERE seat_id='5';<br><br>
<b>7. Add flight to from paris to TLV:</b><br>
<input type="radio" name="qid" value="7">INSERT INTO flight (airline_id, flight_number, depart_airport, arrival_airport, depart_date, arrive_date) VALUES ('1', 'TLV433', 'Paris', 'Ben Gurion', '2013-08-15', '2013-08-16');<br><br>
<b>8. Add booking under Yizhar of 1 ticket on the name of Guy Lev:</b><br>
<input type="radio" name="qid" value="8">INSERT INTO booking (booking_id, user_id, payment_method_id, booking_date) VALUES ('4', '1', '2', '2013-08-15');<br>INSERT INTO ticket (booking_id, seat_id, passport_number, first_name, last_name) VALUES ('4', '3', '192949568', 'Guy', 'Lev')<br><br>
<b>9. Cancel flight TLV433:</b><br>
<input type="radio" name="qid" value="9">DELETE FROM flight WHERE flight_id='6';<br><br>
<b>10. Cancel Payment Method:</b><br>
<input type="radio" name="qid" value="10">DELETE FROM payment_method WHERE method_id='1';<br><br>

<p><b>Submit to server</b><br><input type="submit" value="Submit"></p>
</form>

</body>
</html>